package com.bckj.fastboot.core.extra.dbsearch.dbview;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DbViewFactory {

    public static final Map<String, DbView> DB_VIEW_MAP = new HashMap<>();
    public static DbView getDbView(String viewId) {
        return DB_VIEW_MAP.get(viewId);
    }

    @Resource
    private List<DbView> dbViews;

    @PostConstruct
    public void init() {
        for (DbView view : dbViews) {
            DB_VIEW_MAP.put(view.getId(), view);
        }
    }
}
